version: '3'

services:
        bot:
                build: ./bot
                command: /usr/bin/readlaterbot/readlaterbot
                networks:
                        - app-network         
                restart: unless-stopped
                environment:
                        - TELEGRAM_BOT_TOKEN=527889390:AAGbVA0xtBjJ_XA_zD9i33XFtxErY4t_0UE
                        - MATRIX_HOMESERVER_URL=https://matrix.org
                        - MATRIX_USERNAME=gnamenos
                        - MATRIX_PASSWORD=WMpzJ3hcWE4e6M
                        - POSTGRES_URL=db
                        - POSTGRES_USER=postgres
                        - POSTGRES_DB=ReadLaterBot
                        - RUST_BACKTRACE=1


                depends_on: 
                        - db
                        - mercury
                        - readability
                          
        db:
                image: postgres:15-alpine
                networks:
                        - app-network
                restart: unless-stopped
                ports:
                       - "5432:5432"
                environment:
                        - POSTGRES_DB=ReadLaterBot
                        - POSTGRES_HOST_AUTH_METHOD=trust
                        # - POSTGRES_USER=postgresql
                volumes:
                        - postgres_data:/var/lib/postgresql/data
        mercury:
                image: wangqiru/mercury-parser-api
                restart: unless-stopped
                ports:
                        - "3000:3000"
                networks:
                        - app-network
        readability:
        #         image: phpdockerio/readability-js-server
                build: ../readability-js-server
                restart: unless-stopped
                ports:
                        - "3020:3020"
                networks:
                        - app-network
        article-extractor:
        #         image: phpdockerio/readability-js-server
                build: ../article-extractor-api
                restart: unless-stopped
                ports:
                        - "3010:3010"
                networks:
                        - app-network
networks:
  app-network:
    driver: bridge
volumes:
        postgres_data:
